<?php

	//executeInsertQuery.php
	//Function used to connect to the database and runs the given Query.
	//Original Creator: Rowan Spence		
	
	function executeQuery($query)
	{	
		// Check to see if the connection can be made to the MySQL Server
		$link = mysql_connect("dunk.it.jcu.edu.au", "cp3003_09_g05", "722cf33b8d");
		if(!$link) 
		{
			die('Unable to connect: ' . mysql_error());
		}
		
		// Make sure we can connect to the right Database
		$db_selected = mysql_select_db("cp3003_09_g05");
		if(!$db_selected)
		{
			die('Access permission denied: ' . mysql_error());
		}	
				
		$results = mysql_query($query);
					
		// Close the established connection
		mysql_close($link);

		return $results;
	}	
?>
